﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace safehomeSimulation
{
    public partial class frmInstallSensor : Form
    {
        private Room _toInstall;
        public frmInstallSensor()
        {
            InitializeComponent();
        }

        public frmInstallSensor(ref Room  toInstall)
        {
            InitializeComponent();
            _toInstall = toInstall;
        }

        private void btnOk_Click(object sender, EventArgs e)
        {
            if (chkCO.Checked)
                _toInstall.HasCSensor = true;
            if (chkSmoke.Checked)
                _toInstall.HasSSensor = true;
            if (chkTemperature.Checked)
                _toInstall.HasTSensor = true;
            if (chkWet.Checked)
                _toInstall.HasWSensor = true;
            if (!chkWet.Checked && !chkTemperature.Checked && !chkSmoke.Checked && !chkCO.Checked)
                btnOk.Enabled = false;
            else
            {
                this.DialogResult = DialogResult.OK;
                this.Close();
            }
        }
    }
}
